#include "stdafx.h"

void TestData();
void TestHelpers();

int _tmain(int argc, _TCHAR* argv[])
{
	// **************************************
	//	Iniciar test
	// **************************************
	PrepareTest();

	// **************************************
	//	Pruebas
	// **************************************

	/* Data.cpp ----------------------------- */
	TestData();

	/* Helpers.cpp -------------------------- */
	TestHelpers();

	// **************************************
	//	Liberar test
	// **************************************
	ReleaseTest();

	printf("\n\nPresione cualquier tecla para salir...\n");
	getchar();

	return 0;
}

void TestData() {

	Environment* env = StartTest("Data.cpp");

	env->userData = new DICT();

	SetData(env, "string", (void*) "string");
	SetData(env, "int", (void*) 123);

	std::cout << "Data[string]=" << (char*)GetData(env, "string") << std::endl;
	std::cout << "Data[int]=" << (int)GetData(env, "int") << std::endl;

	std::cout << std::endl;

}

void TestHelpers() {
	Environment* env = StartTest("Helpers.cpp");

	//	IsInField

	StartSubtest("IsInField");
	std::cout << "IsInField(true, 10)=" << IsInField(true, 10)		<< " (1)" << std::endl;
	std::cout << "IsInField(false, 10)=" << IsInField(false, 10)	<< " (0)" << std::endl;
	std::cout << "IsInField(false, 80)=" << IsInField(false, 80)	<< " (1)" << std::endl;
	std::cout << "IsInField(true, 80)=" << IsInField(true, 80)		<< " (0)" << std::endl;
	std::cout << std::endl;

	//	ObtenerAngulo
	
	StartSubtest("ObtenerAngulo");
	std::cout << "ObtenerAngulo(0, 0, 10, 10)="		<< ObtenerAngulo(0, 0, 10, 10)	<< " (45)" << std::endl;
	std::cout << "ObtenerAngulo(0, 0,  0, 10)="		<< ObtenerAngulo(0, 0,  0, 10)	<< " (90)" << std::endl;
	std::cout << "ObtenerAngulo(10, 0, 0, 0)="		<< ObtenerAngulo(10, 0, 0,  0)	<< " (180)" << std::endl;
	std::cout << "ObtenerAngulo(0, 0, -10, 0)="		<< ObtenerAngulo(0, 0, 0, -10)	<< " (270)" << std::endl;
	std::cout << "ObtenerAngulo(0, 0, 10, 1)="		<< ObtenerAngulo(0, 0, 10, 1)	<< " (5.71)" << std::endl;
	std::cout << std::endl;
	
	std::cout << "ObtenerAngulo_viejo(0, 0, 10, 10)="	<< ObtenerAngulo_viejo(0, 0, 10, 10)	<< " (45)" << std::endl;
	std::cout << "ObtenerAngulo_viejo(0, 0,  0, 10)="	<< ObtenerAngulo_viejo(0, 0,  0, 10)	<< " (90)" << std::endl;
	std::cout << "ObtenerAngulo_viejo(10, 0, 0, 0)="	<< ObtenerAngulo_viejo(10, 0, 0,  0)	<< " (180)" << std::endl;
	std::cout << "ObtenerAngulo_viejo(0, 0, -10, 0)="	<< ObtenerAngulo_viejo(0, 0, 0, -10)	<< " (270)" << std::endl;
	std::cout << "ObtenerAngulo_viejo(0, 0, 10, 1)="	<< ObtenerAngulo_viejo(0, 0, 10, 1)		<< " (5.71)" << std::endl;
	std::cout << std::endl;
	
	std::cout << "CalcularAngulo2Pts(0, 0, 10, 10)="	<< CalcularAngulo2Pts(0, 0, 10, 10)	<< " (45)" << std::endl;
	std::cout << "CalcularAngulo2Pts(0, 0,  0, 10)="	<< CalcularAngulo2Pts(0, 0,  0, 10)	<< " (90)" << std::endl;
	std::cout << "CalcularAngulo2Pts(10, 0, 0, 0)="		<< CalcularAngulo2Pts(10, 0, 0,  0)	<< " (180)" << std::endl;
	std::cout << "CalcularAngulo2Pts(0, 0, -10, 0)="	<< CalcularAngulo2Pts(0, 0, 0, -10)	<< " (270)" << std::endl;
	std::cout << "CalcularAngulo2Pts(0, 0, 10, 1)="		<< CalcularAngulo2Pts(0, 0, 10, 1)	<< " (5.71)" << std::endl;
	std::cout << std::endl;


}